#include "framepolaroidjob.h"

#include <jobs/kdcstandardkprocessjob.h>
#include <KStandardDirs>

FramePolaroidJob::FramePolaroidJob( const QPixmap &aInput, QObject *aParent ) : KDCFrameJobInterface( aParent )
{
	aInput.save( pDir.name() + "/out.png", "png" );
	KDCStandardKProcessJob *job = new KDCStandardKProcessJob( this );
	job->setProgram( "convert" );
	job->setWorkingDirectory( pDir.name() );
	job->addArgument( "out.png" );
	job->addArgument( "-bordercolor", "snow" );
	job->addArgument( "-background", "none" );
	job->addArgument( "-polaroid", "0" );
	job->setOutputFile( "out.png" );
	addSubjob( job );
}

FramePolaroidJob::~FramePolaroidJob()
{

}

QPixmap FramePolaroidJob::resultFrame() const
{
	return QPixmap( pDir.name() + "/out.png" );
}
